<html>
<head><meta charset="utf-8"><title>multiple matching crates for std · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html">multiple matching crates for std</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224537603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224537603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224537603">(Jan 29 2021 at 21:41)</a>:</h4>
<p>I pretty regularly get this error</p>
<div class="codehilite"><pre><span></span><code>error[E0464]: multiple matching crates for `std`
  |
  = note: candidates:
          crate `std`: /home/nmatsakis/versioned/rust-4/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7d634c14e33e4972.rlib
</code></pre></div>
<p>Do other people have this problem? I'm not doing anything particularly interesting, mostly <code>x.py build</code> and the occasional <code>x.py test</code>. Sometimes <code>x.py check</code>. I am using vscode.</p>



<a name="224538800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224538800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224538800">(Jan 29 2021 at 21:52)</a>:</h4>
<p>I get similar errors whenever I save a file while <code>x.py build</code> is running, I think because that triggers rust-analyzer to run <code>x.py check</code>. Sometimes I get linker errors on <code>rustc_driver</code> instead</p>



<a name="224538888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224538888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224538888">(Jan 29 2021 at 21:53)</a>:</h4>
<p>One I get often too is</p>
<div class="codehilite"><pre><span></span><code>error[E0460]: found possibly newer version of crate `std` which `rustc_errors` depends on
  --&gt; compiler/rustc_interface/src/callbacks.rs:12:5
   |
12 | use rustc_errors::{Diagnostic, TRACK_DIAGNOSTICS};
   |     ^^^^^^^^^^^^
   |
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `std`: /home/nadrieril/wip/rustc/rustc/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3837264880d10a1c.rmeta
           crate `rustc_errors`: /home/nadrieril/wip/rustc/rustc/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-b06ce8b7ed1bcc93.rmeta
</code></pre></div>



<a name="224539531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224539531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224539531">(Jan 29 2021 at 21:59)</a>:</h4>
<p>Yes, i get some like that</p>



<a name="224539540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224539540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224539540">(Jan 29 2021 at 21:59)</a>:</h4>
<p>Super frustrating</p>



<a name="224544476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224544476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224544476">(Jan 29 2021 at 22:28)</a>:</h4>
<p>The <a href="https://github.com/rust-lang/rust/issues/1">#1</a> most likely cause is parallel builds of x.py check and x.py build</p>



<a name="224544512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224544512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224544512">(Jan 29 2021 at 22:28)</a>:</h4>
<p>my recommendation is to do something like 'cd otherdir &amp;&amp; ./x.py check' in vscode if you can pull it off</p>



<a name="224545220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224545220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224545220">(Jan 29 2021 at 22:35)</a>:</h4>
<p>it's probably rust-analyzer running x.py check</p>



<a name="224561558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224561558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224561558">(Jan 30 2021 at 02:54)</a>:</h4>
<p>It's surprising though, because I often get cargo waiting on a lock, which I guess is exactly to prevent these sorts of things</p>



<a name="224561580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224561580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224561580">(Jan 30 2021 at 02:55)</a>:</h4>
<p>I guess this means the error appears in between cargo invocations, probably when x.py does some magic with the sysroot?</p>



<a name="224562793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224562793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224562793">(Jan 30 2021 at 03:27)</a>:</h4>
<p>Correct</p>



<a name="224585158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224585158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224585158">(Jan 30 2021 at 13:28)</a>:</h4>
<p>Is there a way to synchronize this?</p>



<a name="224585164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224585164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224585164">(Jan 30 2021 at 13:28)</a>:</h4>
<p>I don't know what you meant by <code>cd otherdir</code> <span class="user-mention" data-user-id="116122">@simulacrum</span> -- what other dir?</p>



<a name="224585467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224585467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224585467">(Jan 30 2021 at 13:36)</a>:</h4>
<p>build is relative to the cwd by default, so any other directory should work, i.e., <code>cd foo &amp;&amp; ./../x.py check</code> would create a separate build directory inside foo.</p>



<a name="224585566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224585566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224585566">(Jan 30 2021 at 13:39)</a>:</h4>
<p>oh, I understand now</p>



<a name="224585569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224585569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224585569">(Jan 30 2021 at 13:39)</a>:</h4>
<p>that's...quite a hack, but makes sense!</p>



<a name="224585581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224585581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224585581">(Jan 30 2021 at 13:39)</a>:</h4>
<p>maybe we should introduce a lock to x.py instead though</p>



<a name="224586388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224586388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224586388">(Jan 30 2021 at 13:58)</a>:</h4>
<p>Yeah, I ... don't disagree that we should. Just haven't gotten around to it. I think there's an open bug.</p>



<a name="224586956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224586956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224586956">(Jan 30 2021 at 14:11)</a>:</h4>
<p>It's not trivial to get a file lock right cross platform and I'm not sure there's nice crates already.</p>



<a name="224587798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224587798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224587798">(Jan 30 2021 at 14:31)</a>:</h4>
<p>How does cargo do it?</p>



<a name="224588615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224588615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224588615">(Jan 30 2021 at 14:51)</a>:</h4>
<p>isn't this a python script</p>



<a name="224588617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224588617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224588617">(Jan 30 2021 at 14:51)</a>:</h4>
<p>maybe python has come convenient snippet for this..?</p>



<a name="224588623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224588623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224588623">(Jan 30 2021 at 14:51)</a>:</h4>
<p>(well, I realize it shells out to rust almost immediately)</p>



<a name="224589021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224589021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224589021">(Jan 30 2021 at 15:00)</a>:</h4>
<p>I think cargo hand rolls it to some extent</p>



<a name="224589028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224589028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224589028">(Jan 30 2021 at 15:00)</a>:</h4>
<p>I'm not aware of any python facility to do it</p>



<a name="224602504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/224602504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#224602504">(Jan 30 2021 at 20:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std/near/224586388">said</a>:</p>
<blockquote>
<p>Yeah, I ... don't disagree that we should. Just haven't gotten around to it. I think there's an open bug.</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/76661">https://github.com/rust-lang/rust/issues/76661</a></p>



<a name="225333951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/225333951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#225333951">(Feb 05 2021 at 18:01)</a>:</h4>
<p>Wow, you're saying that for once, my workflow of making fresh <code>objdir/</code> with different variants of <code>config.toml</code> is actually a win? (Potentially?)</p>



<a name="225334209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/225334209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#225334209">(Feb 05 2021 at 18:03)</a>:</h4>
<p>it'll definitely help with this</p>



<a name="225342822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/multiple%20matching%20crates%20for%20std/near/225342822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/multiple.20matching.20crates.20for.20std.html#225342822">(Feb 05 2021 at 19:11)</a>:</h4>
<p>I hadn't, until this moment, actually tried building (<code>../x.py build &amp;&amp; ../x.py test</code>) in two such directories for the same src root <em>concurrently</em>. It does not work as well as I had hoped.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>